package com.itqf.client;

import feign.hystrix.FallbackFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/23
 * @Time: 下午5:16
 */
@Component
public class TbItemFeiginClientFactory implements FallbackFactory<TbItemFeignClient> {
    Log logFactory = LogFactory.getLog(TbItemFeiginClientFactory.class);

    @Resource
    private TbItemFeignClientFallBack tbItemFeignClientFallBack;

    @Override
    public TbItemFeignClient create(Throwable throwable) {
        System.out.println("调用出问题啦......");
        throwable.printStackTrace();

        logFactory.error(throwable.getLocalizedMessage());
        return tbItemFeignClientFallBack;
    }
}
